//
//  LGInputBarItemView.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/3/22.
//

#import "LGInputBarItemView.h"

@interface LGInputBarItemView()

/**   */
@property (nonatomic , strong)UIButton *quickReplyBtn;
/**  历史记录 */
@property (nonatomic , strong)UIButton *historyBtn;
/**   */
@property (nonatomic , strong)UIButton *consultSummaryBtn;

@end

@implementation LGInputBarItemView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        [self addSubview:self.quickReplyBtn];
        [self addSubview:self.historyBtn];
        if ([AppTitle isEqualToString:@"圆荷健康"]) {
            //没有开具医嘱
            [self addSubview:self.consultOverBtn];
            self.consultOverBtn.frame = CGRectMake(viewPix(8)+kMaxX(self.historyBtn.frame), viewPix(8), viewPix(97), viewPix(26));
        }else{
            //
            [self addSubview:self.consultSummaryBtn];
            [self addSubview:self.consultOverBtn];
        }
    }
    return self;
}


-(void)setHistoryNum:(NSString *)historyNum{
    _historyNum = historyNum;
    NSString *content = [NSString stringWithFormat:@"历史%@次团队咨询记录",historyNum];
    [self.historyBtn setTitle:content forState:UIControlStateNormal];
}


-(void)buttonTouchAction:(UIButton *)sender{
    NSString *type = @"";
    if(sender == self.quickReplyBtn){
        type = @"quickReply";
    }else if(sender == self.historyBtn){
        type = @"history";
        
    }else if (sender == self.consultSummaryBtn){
        type = @"consultSummary";
    }else{
        type = @"consultOver";
    }
    if(self.delegate && [self.delegate respondsToSelector:@selector(inputBarItemSelect:)]){
        [self.delegate inputBarItemSelect:type];
    }
}

-(UIButton *)quickReplyBtn{
    if(!_quickReplyBtn){
        _quickReplyBtn = [UIButton buttonWithTitle:@"快捷回复" titleFont:LGFontWeight(14, UIFontWeightMedium) textColor:@"#3291FF" imageName:@""];
        _quickReplyBtn.frame = CGRectMake(viewPix(12), viewPix(8), viewPix(80), viewPix(26));
        _quickReplyBtn.backgroundColor = [UIColor colorWithString:@"#CCE4FF"];
        _quickReplyBtn.cornerRidus = viewPix(13);
        [_quickReplyBtn addTarget:self action:@selector(buttonTouchAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _quickReplyBtn;
}

-(UIButton *)historyBtn{
    if(!_historyBtn){
        _historyBtn = [UIButton buttonWithTitle:@"历史团队咨询记录" titleFont:LGFontWeight(14, UIFontWeightMedium) textColor:@"#3291FF" imageName:@""];
        _historyBtn.frame = CGRectMake(viewPix(12), viewPix(8), viewPix(160), viewPix(26));
        _historyBtn.backgroundColor = [UIColor colorWithString:@"#CCE4FF"];
        _historyBtn.cornerRidus = viewPix(13);
        [_historyBtn addTarget:self action:@selector(buttonTouchAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _historyBtn;
}

-(UIButton *)consultSummaryBtn{
    if(!_consultSummaryBtn){
        _consultSummaryBtn = [UIButton buttonWithTitle:@"开具医嘱" titleFont:LGFontWeight(14, UIFontWeightMedium) textColor:@"#3291FF" imageName:@""];
        _consultSummaryBtn.frame = CGRectMake(viewPix(8)+kMaxX(self.quickReplyBtn.frame), viewPix(8), viewPix(80), viewPix(26));
        _consultSummaryBtn.backgroundColor = [UIColor colorWithString:@"#CCE4FF"];
        _consultSummaryBtn.cornerRidus = viewPix(13);
        [_consultSummaryBtn addTarget:self action:@selector(buttonTouchAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _consultSummaryBtn;
}

-(UIButton *)consultOverBtn{
    if(!_consultOverBtn){
        _consultOverBtn = [UIButton buttonWithTitle:@" 结束咨询" titleFont:LGFontWeight(14, UIFontWeightMedium) textColor:@"#BE3F3F" imageName:@"consultOver"];
        _consultOverBtn.frame = CGRectMake(viewPix(8)+kMaxX(self.consultSummaryBtn.frame), viewPix(8), viewPix(97), viewPix(26));
        _consultOverBtn.backgroundColor = [UIColor colorWithString:@"#FFD0D0"];
        _consultOverBtn.cornerRidus = viewPix(13);
        [_consultOverBtn addTarget:self action:@selector(buttonTouchAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _consultOverBtn;
}


@end
